'''
Created on Nov 31, 2009

@author: mkiyer
'''

import veggie.db.refdb as refdb
import os
import logging

__sdbi = None
def get_sampledb_instance(path=None):
    global __sdbi
    if __sdbi == None:
        if path == None:
            path = os.path.join(refdb.root, 'sample', 'sampledb.pickle')
        assert os.path.exists(path)
        import veggie.db.sample.sampledb3 as sdb
        logging.debug("Loading SampleDB instance at %s" %
                      os.path.abspath(path))
        __sdbi = sdb.SampleDBInstance.load(path)
    return __sdbi